version 8.2
capture clear
capture log close
set more off
set mem 5000m
set mat 2000


use "Enterprise surveys_judicial_reforms_standardized dataset.dta", replace

sum DJ4g1m
centile(DJ4g1m), centile(50)
display `r(c_1)'
*hist DJ4g1, percent

label variable h7a "Judicial efficiency"
label variable reform_dum1_post "Judicial reform * Post" 
label variable reform_dum1_post_DJ4g1m  "Judicial reform * Post * Specific" 
label variable reform_dum_small1_post "Limited judicial reform * Post" 
label variable dtf "Business climate"
replace foreign_aid2_percap=foreign_aid2_percap*1000000
label variable  foreign_aid2_percap "Foreign aid per capita"

replace va_perwo_ppp_trim1 =va_perwo_ppp_trim1 /1000
label variable va_perwo_ppp_trim1 "Value added per worker (Thousand dollars)"


replace va=va/1000
label variable va "Value Added (Thousand dollars)" 
/*
revenue minus cost of intermediate inputs
va=d2-n2b-n2c-n2d-n2e-n2f-n2g-n2h
*/
replace n7_perwo_ppp_trim1=n7_perwo_ppp_trim1/1000
label variable n7_perwo_ppp_trim1 "Capital stock per worker (Thousand dollars)" 
/*
Just manufacturing sector
If this establishment had to hypothetically purchase the land and buildings, and machinery and equipment in
use now, as they are in their current condition, how much would it cost to purchase each of the following?
LCUs
a. Machinery vehicles, and equipment n7a
b. Land and buildings n7b
in ppp, trimmed 1 percent
*/
label variable prop_skill "Proportion of skilled workers" 
/*
Just manufacturing sector
l4a/l3a
number full-time employees Skilled production workers / number Production workers
*/
label variable size_num "Number employees" 
*total number of employees (adjusted for part-time)
label variable new_firm "New firm" 
*new_firm=1 if firm created after baseline


sum va_perwo_ppp
*max of 4.71e+07: 47 billion$ per worker
sum va_perwo_ppp_trim1
*max of 3398.723: 3 million$ per worker


***Judicial reforms
label variable reform_dum1 "Comprehensive Judicial Reform"
label variable reform_dum_small1 "Limited Judicial Reform"

***Relationship-specific investment
label variable DJ4g1m "Specific"
label variable DJ4s1m "Herfindhal Sweden"
label variable DJ4s2m "Input/output Sweden"
label variable DJ4c1m "Herfindhal Continent" 
label variable DJ4c2m "Input/output Continent"

 
***Control variables
label variable dtf "Business climate"
label variable foreign_aid "Net ODA received per capita"
 

global list_var h7a va_perwo_ppp_trim1 n7_perwo_ppp_trim1 prop_skill size_num new_firm ///*Firm data
reform_dum1 reform_dum_small1 ///*Judicial reforms
DJ4g1m DJ4s1m DJ4s2m DJ4c1m DJ4c2m ///*Relationship-specific investment
dtf foreign_aid ///*Control variables




eststo desc_stat: estpost sum $list_var

esttab desc_stat using "Table1.tex", tex plain cells("mean(label(Mean) fmt(2)) sd(label(SD) fmt(2)) count(label(N) fmt(0))") mtitles("Desc Stat") refcat(h7a "Firm data" reform_dum1 "Judicial reforms" DJ4g1m "Relationship-specific investment" dtf "Control variables", nolabel) noobs replace label title(Descriptive Statistics)


exit

